#!/bin/sh

indicator_module="@kmodule_name@.ko"
indicator_name="ro_file"

. ../test_common.sh

filename="some_string"
filecontent="some_string"

init_test

echo "$indicator_name" > "${point_dir}/current_indicator"

if test $? -ne 0; then
	printf "Cannot set indicator for the point.\n"
	finalize_test
	exit 1
fi

if  ! simulate; then
	printf "Simulate shouldn't fail with \"never\" scenario.\n"
	finalize_test
	exit 1
fi

if  ! test -e "${point_dir}/${filename}"; then
	printf "File '%s' is not created.\n" "${point_dir}/${filename}"
	finalize_test
	exit 1
fi

if  ! test -r "${point_dir}/${filename}"; then
	printf "File '%s' cannot be read.\n" "${point_dir}/${filename}"
	finalize_test
	exit 1
fi

if  test "`cat "${point_dir}/${filename}"`" != "${filecontent}"; then
	printf "The contents of the file are '%s' but should be '%s'.\n" `cat "${point_dir}/${filename}"` "${filecontent}"
	finalize_test
	exit 1
fi

finalize_test
